package cn.txm.product.mapper;

import cn.txm.basic.mapper.BaseMapper;
import cn.txm.product.domain.Shopcart;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
public interface ShopcartMapper extends BaseMapper<Shopcart>{
    /**
     * 通过user_id和product_id查询购物车表数据
     * @param user_id
     * @param product_id
     * @return
     */
    Shopcart findByUserIdAndProductId(@Param("user_id")Long user_id, @Param("product_id")Long product_id);

    /**
     * 根据前台用户id，查询它的购物车数据
     * @param user_id
     * @return
     */
    List<Shopcart> getMyShopcarts(Long user_id);
}
